ioemu: Include mouse dz in xenfb event packet
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 10 Dec 2007 13:49:22 +0000 (13:49 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 10 Dec 2007 13:49:22 +0000 (13:49 +0000)
Needed for mouse wheel support in a PV guest.

Signed-off-by: Pat Campbell <plc@novell.com>
tools/ioemu/hw/xenfb.c
xen/include/public/io/kbdif.h

index f3ee4b2d0221f0bf98072b9da0cceb67c16e2f65..f0d7f7936ef50d02dedaa5e3a990dc1554f08865 100644 (file)
@@ -592,7 +592,7 @@ static int xenfb_send_key(struct xenfb *xenfb, bool down, int keycode)
 }
 
 /* Send a relative mouse movement event */
-static int xenfb_send_motion(struct xenfb *xenfb, int rel_x, int rel_y)
+static int xenfb_send_motion(struct xenfb *xenfb, int rel_x, int rel_y, int rel_z)
 {
        union xenkbd_in_event event;
 
@@ -600,12 +600,13 @@ static int xenfb_send_motion(struct xenfb *xenfb, int rel_x, int rel_y)
        event.type = XENKBD_TYPE_MOTION;
        event.motion.rel_x = rel_x;
        event.motion.rel_y = rel_y;
+       event.motion.rel_z = rel_z;
 
        return xenfb_kbd_event(xenfb, &event);
 }
 
 /* Send an absolute mouse movement event */
-static int xenfb_send_position(struct xenfb *xenfb, int abs_x, int abs_y)
+static int xenfb_send_position(struct xenfb *xenfb, int abs_x, int abs_y, int abs_z)
 {
        union xenkbd_in_event event;
 
@@ -613,6 +614,7 @@ static int xenfb_send_position(struct xenfb *xenfb, int abs_x, int abs_y)
        event.type = XENKBD_TYPE_POS;
        event.pos.abs_x = abs_x;
        event.pos.abs_y = abs_y;
+       event.pos.abs_z = abs_z;
 
        return xenfb_kbd_event(xenfb, &event);
 }
@@ -1043,9 +1045,10 @@ static void xenfb_mouse_event(void *opaque,
     if (xenfb->abs_pointer_wanted)
            xenfb_send_position(xenfb,
                                dx * xenfb->ds->width / 0x7fff,
-                               dy * xenfb->ds->height / 0x7fff);
+                               dy * xenfb->ds->height / 0x7fff,
+                               dz);
     else
-           xenfb_send_motion(xenfb, dx, dy);
+           xenfb_send_motion(xenfb, dx, dy, dz);
 
     for (i = 0 ; i < 8 ; i++) {
            int lastDown = xenfb->button_state & (1 << i);
index 38193c8541701ae38a01837da13c85c3858438f7..7b4e404335999b92c84cb63f714bbc776ac74bd8 100644 (file)
@@ -50,6 +50,7 @@ struct xenkbd_motion
     uint8_t type;        /* XENKBD_TYPE_MOTION */
     int32_t rel_x;       /* relative X motion */
     int32_t rel_y;       /* relative Y motion */
+    int32_t rel_z;       /* relative Z motion (wheel) */
 };
 
 struct xenkbd_key
@@ -64,6 +65,7 @@ struct xenkbd_position
     uint8_t type;        /* XENKBD_TYPE_POS */
     int32_t abs_x;       /* absolute X position (in FB pixels) */
     int32_t abs_y;       /* absolute Y position (in FB pixels) */
+    int32_t abs_z;       /* absolute Z position (wheel) */
 };
 
 #define XENKBD_IN_EVENT_SIZE 40